import request from '@/utils/request'

// 查询采购列表
export function listPerchase(query) {
  return request({
    url: '/system/purchaseOrder/list',
    method: 'get',
    params: query
  })
}

// 查询采购详细
export function getPerchase(id) {
  return request({
    url: '/system/purchaseOrder/' + id,
    method: 'get'
  })
}
// 查询采购订单产品详情
export function getPerchasedetail(id) {
  return request({
    url: '/system/purchaseOrder/partMsg/' + id,
    method: 'get'
  })
}
// 查询采购订单操作详情
export function getcz(id) {
  return request({
    url: '/system/purchaseOrder/orderMsg_get/' + id,
    method: 'get'
  })
}

// 新增采购
export function addPerchase(data) {
  return request({
    url: '/system/purchaseOrder',
    method: 'post',
    data: data
  })
}

// 修改采购
export function updatePerchase(data) {
  return request({
    url: '/system/purchaseOrder',
    method: 'put',
    data: data
  })
}

// 删除采购
export function delPerchase(id) {
  return request({
    url: '/system/purchaseOrder/' + id,
    method: 'delete'
  })
}
// 采购订单详情的供应商信息
export function getsupplier(id){
  return request({
    url:'/system/purchaseOrder/partnerMsg/'+id,
    method:'get'
  })
}
// 采购订单新增询价单请求
export function addprocure(data){
  return request({
    url:'/system/purchaseOrder/purchaseOrder_write',
    method:'post',
    data:data
  })
}
// 采购订单新增询价单订单行选择的产品列表
export function stockListAPI(name){
  return request({
    url:'/system/purchaseOrder/purchaseOrderPart_stocks/t/'+name,
    method:'get',
    
  })
}
// 采购订单修改订单行选择的产品列表
export function stockList1API(name){
  return request({
    url:'/system/purchaseOrder/purchaseOrderPart_stocks/f/'+name,
    method:'get',
    
  })
}
// 采购订单新增询价单订单行选择的产品列表详情
export function stockListdedtail(id){
  return request({
    url:'/system/purchaseOrder/purchaseOrderPart_get/'+id,
    method:'get',
    
  })
}
// 采购订单新增询价单订单行删除
export function delorder(id){
  return request({
    url:'/system/purchaseOrder/purchaseOrderPart_delete/'+id+'/t',
    method:'get',
    
  })
}
// 采购订单编辑时订单行删除
export function delorder1(id){
  return request({
    url:'/system/purchaseOrder/purchaseOrderPart_delete/'+id+'/f',
    method:'get',
    
  })
}

// 采购询价单 新增 放弃
export function cancelsale() {
  return request({
    url: '/system/purchaseOrder/orderUpdate_abandon',
    method: 'get'
  })
}
// 新增时修改询价单订单行
export function editorderzz(id) {
  return request({
    url: '/system/purchaseOrder/purchaseOrderPart_info/'+id+'/t',
    method: 'get'
  })
}
// 编辑时修改询价单订单行
export function editorderzz1(id) {
  return request({
    url: '/system/purchaseOrder/purchaseOrderPart_info/'+id+'/f',
    method: 'get'
  })
}
// 修改报价单订单行提交
export function editorderzzsub(data) {
  return request({
    url: '/system/purchaseOrder/purchaseOrderPart_update',
    method: 'put',
    data:data
  })
}
// 取消采购订单状态
export function cancelState(id) {
  return request({
    url: '/system/purchaseOrder/orderCancel/'+id,
    method: 'get'
  })
}
// 确认采购订单状态
export function sureState(id) {
  return request({
    url: '/system/purchaseOrder/orderConfirm/'+id,
    method: 'get'
  })
}
// 采购合同打印
export function pOrderContact() {
  return request({
    url: '/system/print/pOrderContact',
    method: 'get',
    responseType: 'blob',
   
  })
}